import request from '@/utils/request'
import { getToken } from '@/utils/auth'

export function getListPage(query) {
  return request({
    url: '/repair/kfkProducerRecord/',
    method: 'get',
    params: query
  })
}

export function getConsumerList(query) {
  return request({
    url: '/repair/kfkConsumerRecord/',
    method: 'get',
    params: query
  })
}

export function getResourceType(query) {
  return request({
    url: '/repair/kfkProducerRecord/listType',
    method: 'get',
    params: query
  })
}

// 模板名称列表
export function getTemplates(query) {
  return request({
    url: '/repair/excel/listType',
    method: 'get',
    params: query
  })
}

// 下载模板
export function downloadTemplate(params) {
  return request({
    url: '/repair/excel/download',
    method: 'get',
    headers: {
      'Content-Type': 'application/octet-stream' // 流
    },
    'Content-Type': 'application/octet-stream',
    responseType: 'blob',
    params: Object.assign({}, params, {
      access_token: getToken()
    })
  })
}
